# -*- coding: utf-8 -*-
# @Time : 2022/6/20 下午3:20
# @Author : wyf
# @FileName: 作业8.py
# @Email: yunfei.wang@innvote.com
import hashlib

import requests


class Login(object):

    def login(self):

        url = "https://my.zhaoxi.net//diy/getlogin.php"
        data = {
            "action": "login",
            "txtusername": "123456778",  # 帐号
            "txtpassword": self.md5_passwd("password")  # 密码(MD5加密)
        }
        print(data)
        req = requests.post(url, data)
        print(req.text)


    @staticmethod
    def md5_passwd(passwd: str):
        md5 = hashlib.md5()
        md5.update(passwd.encode("utf-8"))
        return md5.hexdigest()


if __name__ == '__main__':
    Login().login()
